Skip to main content

Anaerobic Digester block

Activated Sludge model to Anaerobic Digester model (ASM2ADM)

The purpose of ASM2ADM is to transform the state variables from the activated sludge section corresponding to the ASM formulation into state variables usable in the AD.

Mapping ASM state variables to ADM state variables

Input

  1. Mixing flow from:
    1. underflow of the primary clarifier
    2. thickened secondary sludge wasted from the secondary clarifier (settler) (underflow from thickener)
    3. Input State (ASM state variables) (unit: g CODm^-3 or g N m^-3 for variable with N or mole HCO3-*m^-3 for Salk):
      1. Soluble: Si, Ss, So, Sno, Snh, Snd, Salk
      2. Particulate: Xi, Xs, Xbh, Xba, Xp, Xnd
    4. Other inputs:
      1. Q
      2. T
      3. TSS-load (store in Particulate[6] with the first index = 0)
  2. pH from ADM1 model (pH_adm)

Parameter

The parameters are stored in INTERFACEPAR variable in MATLAB

indexParameterDescriptionValueUnitNote
0CODequiv2.857143
1fnaaFraction of N in amino acids and Xpr0.098
2fnxcN content of composite material based on BSM20.0376
3fnbacN content of biomass based on BSM10.08same in AS and AD
4fxniN content of inerts XI and XP0.06same in AS and AD
5fsniN content of SI0assumed zero in ASM1 and BSM1
6fsni_admN content of SI in the AD system0.06
7frlixslipid fraction of non-nitrogenous Xs0.7
8frlibaclipid fraction of non-nitrogenous biomass0.4
9frxs_admanaerobically degradable fraction of AS biomass0.68
10fdegrade_admamount of AS XI and XP degradable in AD0zero in BSM2
11frxs_asaerobically degradable fraction of AD biomass0.79Not used in ASM2ADM
12fdegrade_asamount of AD XI and XP degradable in AS0Not used in ASM2ADM, zero in BSM2
13Runiversal gas constant0.083145dm3*bar/(mol*K)
14T_basebase temperature (25 degC in K)298.15K
15T_opoperational temperature of AD and interface (35 degC in T)308.15KShould be an input variable if dynamic temperature control is used
16pK_w_base14
17pK_a_va_base4.86
18pK_a_bu_base4.82
19pK_a_pro_base4.88
20pK_a_ac_base4.76
21pK_a_co2_base6.35
22pK_IN_base9.25

Transform state variables (Z) from AS to AD

  1. Z_AS = Mixing flow from the two inputs
  2. Temperature in AD = 35 degree celsius
  3. The equation is based on temperature at 25 degree celsius
    1. Convert pKa (T=25) to pKa (T=35)

Output

  1. Output ports (Collimator model)

    1. Q (y[26])
    2. T (y[27])
    3. y_output (y[0:25] describe in point 2)
  2. y is the output in ADM1 terminology + extra dummy states, 33 variables as describe in Matlab model

    1. y[0] : Ssu = monosacharides (kg COD/m3)
    2. y[1] : Saa = amino acids (kg COD/m3)
    3. y[2] : Sfa = long chain fatty acids (LCFA) (kg COD/m3)
    4. y[3] : Sva = total valerate (kg COD/m3)
    5. y[4] : Sbu = total butyrate (kg COD/m3)
    6. y[5] : Spro = total propionate (kg COD/m3)
    7. y[6] : Sac = total acetate (kg COD/m3)
    8. y[7] : Sh2 = hydrogen gas (kg COD/m3)
    9. y[8] : Sch4 = methane gas (kg COD/m3)
    10. y[9] : Sic = inorganic carbon (kmole C/m3)
    11. y[10] : Sin = inorganic nitrogen (kmole N/m3)
    12. y[11] : Si = soluble inerts (kg COD/m3)
    13. y[12] : Xxc = composites (kg COD/m3)
    14. y[13] : Xch = carbohydrates (kg COD/m3)
    15. y[14] : Xpr = proteins (kg COD/m3)
    16. y[15] : Xli = lipids (kg COD/m3)
    17. y[16] : Xsu = sugar degraders (kg COD/m3)
    18. y[17] : Xaa = amino acid degraders (kg COD/m3)
    19. y[18] : Xfa = LCFA degraders (kg COD/m3)
    20. y[19] : Xc4 = valerate and butyrate degraders (kg COD/m3)
    21. y[20] : Xpro = propionate degraders (kg COD/m3)
    22. y[21] : Xac = acetate degraders (kg COD/m3)
    23. y[22] : Xh2 = hydrogen degraders (kg COD/m3)
    24. y[23] : Xi = particulate inerts (kg COD/m3)
    25. y[24] : scat+ = cations (metallic ions, strong base) (kmole/m3)
    26. y[25] : san- = anions (metallic ions, strong acid) (kmole/m3)
    27. y[26] : flow rate (m3/d) (put in separate port for Collimator model)
    28. y[27] : temperature (deg C) (put in separate port for Collimator model)
    29. y[28:32] : dummy states for future use (omit from Collimator model)

Anaerobic Digester model

ADM1

Input

  1. Q, T, y_output from ASM2ADM block (u[0:32] 33 variables in Matlab; 28 in collimator)
  2. Output from pH solver (7) (u[33:39] 7 variables in Matlab; )
  3. Output from Sh2 solver (1) (u[40] 1 variable in Matlab; )

Parameters

  1. Input Parameters
    1. DIGESTERINIT (42)
    2. DIGESTERPAR (100)
    3. DIM_D (2)
      1. V_liq = 3400 m3 size of BSM2 AD
      2. V_gas = 300 m3 size of BSM2 AD
  2. Calculated Parameters
    1. factor = (1.0/T_base - 1.0/T_op)/(100.0*R);
    2. K_H_h2 = K_H_h2_baseexp(-4180.0factor); /T adjustment for K_H_h2/
    3. K_H_ch4 = K_H_ch4_baseexp(-14240.0factor); /T adjustment for K_H_ch4/
    4. K_H_co2 = K_H_co2_baseexp(-19410.0factor); /T adjustment for K_H_co2/
    5. K_w = pow(10,-pK_w_base)exp(55900.0factor); / T adjustment for K_w /
    6. p_gas_h2o = K_H_h2o_baseexp(5290.0(1.0/T_base - 1.0/T_op)); /* T adjustment for water vapour saturation pressure
    7. ...
  3. Variables from input
    1. S_H_ion = u[33] H+
    2. pH_op = -log10*(u[33]) pH

State variables

  1. Temporary state variables (xtemp[i]) (42 variables) (index is according to Matlab model)
    1. index [0:25] is corresponding to state variables input from ASM2ADM block
    2. index [26:31] is corresponding to state variables input from pH solver
    3. index [32:34] is corresponding to state of gas variables in AD
    4. index [35] is corresponding to flow rate
    5. index [36] is corresponding to temperature in deg C
    6. index [37:41] is corresponding to dummy variables (omit from collimator)

Output

Output ports = 52 in Matlab and 47 in Collimator x[i] = state of i variable

  1. Q_output = Q_input flow rate (m3/d) (put in separate port for Collimator model)
  2. T_output = T_op - 273.15 temperature (deg C) (put in separate port for Collimator model)
  3. Omit dummy variables: y[28:32] dummy states for future use (omit from Collimator model)
  4. y[0] : Ssu = x[0] monosacharides (kg COD/m3)
  5. y[1] : Saa = x[1] amino acids (kg COD/m3)
  6. y[2] : Sfa = x[2] long chain fatty acids (LCFA) (kg COD/m3)
  7. y[3] : Sva = x[3] total valerate (kg COD/m3)
  8. y[4] : Sbu = x[4] total butyrate (kg COD/m3)
  9. y[5] : Spro = x[5] total propionate (kg COD/m3)
  10. y[6] : Sac = x[6] total acetate (kg COD/m3)
  11. y[7] : Sh2 = u[40] = input from Sh2 port hydrogen gas (kg COD/m3)
  12. y[8] : Sch4 = x[8] methane gas (kg COD/m3)
  13. y[9] : Sic = x[9] inorganic carbon (kmole C/m3)
  14. y[10] : Sin = x[10] inorganic nitrogen (kmole N/m3)
  15. y[11] : Si = x[11] soluble inerts (kg COD/m3)
  16. y[12] : Xxc = x[12] composites (kg COD/m3)
  17. y[13] : Xch = x[13] carbohydrates (kg COD/m3)
  18. y[14] : Xpr = x[14] proteins (kg COD/m3)
  19. y[15] : Xli = x[15] lipids (kg COD/m3)
  20. y[16] : Xsu = x[16] sugar degraders (kg COD/m3)
  21. y[17] : Xaa = x[17] amino acid degraders (kg COD/m3)
  22. y[18] : Xfa = x[18] LCFA degraders (kg COD/m3)
  23. y[19] : Xc4 = x[19] valerate and butyrate degraders (kg COD/m3)
  24. y[20] : Xpro = x[20] propionate degraders (kg COD/m3)
  25. y[21] : Xac = x[21] acetate degraders (kg COD/m3)
  26. y[22] : Xh2 = x[22] hydrogen degraders (kg COD/m3)
  27. y[23] : Xi = x[23] particulate inerts (kg COD/m3)
  28. y[24] : scat+ = x[24] cations (metallic ions, strong base) (kmole/m3)
  29. y[25] : san- = x[25] anions (metallic ions, strong acid) (kmole/m3)
  30. Output corresponding to pH solver block
    1. y[33] (y[26] in collimator): ph_op = -log10(u[33]) (u[33] = pH_solver_input[0]) pH
    2. y[34] (y[27] in collimator): u[33] (u[33] = pH_solver_input[0]) SH+
    3. y[35] (y[28] in collimator): u[34] (u[34] = pH_solver_input[1]) Sva-
    4. y[36] (y[29] in collimator): u[35] (u[35] = pH_solver_input[2]) Sbu-
    5. y[37] (y[30] in collimator): u[36] (u[36] = pH_solver_input[3]) Spro-
    6. y[38] (y[31] in collimator): u[37] (u[37] = pH_solver_input[4]) Sac-
    7. y[39] (y[32] in collimator): u[38] (u[38] = pH_solver_input[5]) SHCO3-
    8. y[40] (y[33] in collimator): x[9] - u[38] (u[38] = pH_solver_input[5]) SCO2
    9. y[41] (y[34] in collimator): u[39] (u[39] = pH_solver_input[6]) SNH3
    10. y[42] (y[35] in collimator): x[10]-u[39] (u[39] = pH_solver_input[6]) SNH4+
  31. Sgas
    1. y[43] (y[36] in collimator): x[32] Sgas, h2
    2. y[44] (y[37] in collimator): x[33] Sgas, ch4
    3. y[45] (y[38] in collimator): x[34] Sgas, co2
    4. y[46] (y[39] in collimator): p_gas_h2 = x[32]RT_op/16.0
    5. y[47] (y[40] in collimator): p_gas_ch4 = x[33]RT_op/64.0
    6. y[48] (y[41] in collimator): p_gas_co2 = x[34]RT_op
    7. y[49] (y[42] in collimator): P_gas = p_gas_h2 + p_gas_ch4 + p_gas_co2 + p_gas_h20
    8. y[50] (y[43] in collimator): q_gas * P_gas/P_atm
      1. q_gas = max(0, k_P*(P_gas - P_atm))
      2. k_P and P_atm = input parameter
    9. y[51] (omit from collimator): u[7] We combine the Sh2 calculation in the ODE instead of having a separate one like in Matlab. #Sh2 output from ASM2ADM block

Sh2 solver

Stiffness of the ADM1 can be reduced by approximating the differential equations of the pH and Sh2 states by algebraic equation

  • Gradient equation:
    • State_input[2] = Sfa = x[2] = Soluble_xtemp[2]
    • State_input[18] = Xfa = x[18] = Particulate_xtemp[6]
    • State_input[10] = Sin = x[10] = Soluble_xtemp[10]
    • State_input[3] = Sva = x[3] = Soluble_xtemp[3]
    • State_input[19] = Xc4 = x[19] = Particulate_xtemp[7]
    • State_input[4] = Sbu = x[4] = Soluble_xtemp[4]
    • State_input[5] = Spro = x[5] = Soluble_xtemp[5]
    • State_input[20] = Xpro = x[20] = Particulate_xtemp[8]
    • State_input[22] = Xh2 = x[22] = Particulate_xtemp[10]

pH solver

  • Need to fix pH solver
    • create ODE for each variable
  • DAE:
    • SH+ equation:
      • SH+ = State_input[24]+(State_input[10]-var[6])+var[0]-var[5]-var[4]/64-var[3]/112-var[2]/160-var[1]/208-K_w/var[0]-State_input[25]
        • var[0] = SH+
        • State_input[24] = scat+
        • State_input[10] = Sin
        • State_input[9] = Sic
        • State_input[6] = Sac
        • State_input[5] = Spro
        • State_input[4] = Sbu
        • State_input[3] = Sva
        • State_input[25] = san-
        • var[6] = SNH3 = K_a_IN*State_input[10]/(K_a_IN+var[0])
        • var[5] = SHCO3- = K_a_co2*State_input[9]/(K_a_co2+var[0])
        • var[4] = Sac- = K_a_ac*State_input[6]/(K_a_ac+var[0])
        • var[3] = Spro- = K_a_pro*State_input[5]/(K_a_pro+var[0])
        • var[2] = Sbu- = K_a_bu*State_input[4]/(K_a_bu+var[0])
        • var[1] = Sva- = K_a_va*State_input[3]/(K_a_va+var[0])
  • ODE:
    • SH+ equation:
      • SH+ = State_input[24]+(State_input[10]-var[6])+var[0]-var[5]-var[4]/64-var[3]/112-var[2]/160-var[1]/208-K_w/var[0]-State_input[25]
    • var[1] = dSvadt\frac{dSva-}{dt} = -ρA,4\rho_{A,4} = kA,Bva(Sva(Ka,va+SH+)Ka,vaSva)k_{A,Bva}(S_{va-}(K_{a,va}+S_{H^+})-K_{a,va}S_{va})
    • var[2] = dSbudt\frac{dSbu-}{dt} = -ρA,5\rho_{A,5} = kA,Bbu(Sbu(Ka,bu+SH+)Ka,buSbu)k_{A,Bbu}(S_{bu-}(K_{a,bu}+S_{H^+})-K_{a,bu}S_{bu})
    • var[3] = dSprodt\frac{dSpro-}{dt} = -ρA,6\rho_{A,6} = kA,Bpro(Spro(Ka,pro+SH+)Ka,proSpro)k_{A,Bpro}(S_{pro^-}(K_{a,pro}+S_{H^+})-K_{a,pro}S_{pro})
    • var[4] = dSacdt\frac{dSac-}{dt} = -ρA,7\rho_{A,7} = kA,Bac(Sac(Ka,ac+SH+)Ka,acSac)k_{A,Bac}(S_{ac^-}(K_{a,ac}+S_{H^+})-K_{a,ac}S_{ac})
    • var[5] = dShco3dt\frac{dShco3-}{dt} = -ρA,10\rho_{A,10} = kA,Bco2(Shco3(Ka,co2+SH+)Ka,co2SIC)k_{A,Bco2}(S_{hco3^-}(K_{a,co2}+S_{H^+})-K_{a,co2}S_{IC})
    • var[6] = dSnh3dt\frac{dSnh3-}{dt} = -ρA,11\rho_{A,11} = kA,BIN(Snh3(Ka,IN+SH+)Ka,INSIN)k_{A,BIN}(S_{nh3}(K_{a,IN}+S_{H^+})-K_{a,IN}S_{IN})

Mapping output

  • There is a room of improvement
  • pH will need to be calculated and stored as output

Anaerobic Digester model to Activated Sludge model

ADM to ASM

Input

u is the input in ADM1 terminology + extra dummy states, 33 variables

  1. Q: flow rate (m3/d) (u[26] in matlab)
  2. T: ADM temperature (deg C) (u[27] in matlab)
  3. State variables (only use u[0:26])
    1. u[0] : Ssu = monosacharides (kg COD/m3)
    2. u[1] : Saa = amino acids (kg COD/m3)
    3. u[2] : Sfa = long chain fatty acids (LCFA) (kg COD/m3)
    4. u[3] : Sva = total valerate (kg COD/m3)
    5. u[4] : Sbu = total butyrate (kg COD/m3)
    6. u[5] : Spro = total propionate (kg COD/m3)
    7. u[6] : Sac = total acetate (kg COD/m3)
    8. u[7] : Sh2 = hydrogen gas (kg COD/m3)
    9. u[8] : Sch4 = methane gas (kg COD/m3)
    10. u[9] : Sic = inorganic carbon (kmole C/m3)
    11. u[10] : Sin = inorganic nitrogen (kmole N/m3)
    12. u[11] : Si = soluble inerts (kg COD/m3)
    13. u[12] : Xc = composites (kg COD/m3)
    14. u[13] : Xch = carbohydrates (kg COD/m3)
    15. u[14] : Xpr = proteins (kg COD/m3)
    16. u[15] : Xli = lipids (kg COD/m3)
    17. u[16] : Xsu = sugar degraders (kg COD/m3)
    18. u[17] : Xaa = amino acid degraders (kg COD/m3)
    19. u[18] : Xfa = LCFA degraders (kg COD/m3)
    20. u[19] : Xc4 = valerate and butyrate degraders (kg COD/m3)
    21. u[20] : Xpro = propionate degraders (kg COD/m3)
    22. u[21] : Xac = acetate degraders (kg COD/m3)
    23. u[22] : Xh2 = hydrogen degraders (kg COD/m3)
    24. u[23] : Xi = particulate inerts (kg COD/m3)
    25. u[24] : scat+ = cations (metallic ions, strong base) (kmole/m3)
    26. u[25] : san- = anions (metallic ions, strong acid) (kmole/m3)
  4. u[33] in Matlab : pH from the pH delay block
  5. u[34] in Matlab : wastewater temperature into the ASM2ADM interface, deg C

Output

Matlab output

  1. y[0] : Si = soluble inert organic material (g COD/m3)
  2. y[1] : Ss = readily biodegradable substrate (g COD/m3)
  3. y[2] : Xi = particulate inert organic material (g COD/m3)
  4. y[3] : Xs = slowly biodegradable substrate (g COD/m3)
  5. y[4] : Xbh = active heterotrophic biomass (g COD/m3)
  6. y[5] : Xba = active autotrophic biomass (g COD/m3)
  7. y[6] : Xp = particulate product arising from biomass decay (g COD/m3)
  8. y[7] : So = oxygen (g -COD/m3)
  9. y[8] : Sno = nitrate and nitrite nitrogen (g N/m3)
  10. y[9] : Snh = ammonia and ammonium nitrogen (g N/m3)
  11. y[10] : Snd = soluble biogradable organic nitrogen (g N/m3)
  12. y[11] : Xnd = particulate biogradable organic nitrogen (g N/m3)
  13. y[12] : Salk = alkalinity (mole HCO3-/m3)
  14. y[13] : TSS = total suspended solids (internal use) (mg SS/l)
  15. y[14] : flow rate (m3/d)
  16. y[15] : temperature (deg C)

Collimator output

  1. Q
  2. T
  3. Soluble: Si, Ss, So, Sno, Snh, Snd, Salk
  4. Particulate: Xi, Xs, Xbh, Xba, Xp, Xnd, TSS